<?php
/**
 * This file is form http://findcat.cn
 *
 * @link     https://findcat.cn
 * @email    1476982312@qq.com
 */
namespace App\Http\Controllers\Home;

use App\Models\Article;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class ArticleController extends Controller
{
    /**
     * 文章详情.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function show(Request $request)
    {
        $article = Article::query()
            ->where('status', true)
            ->with(['tags'])
            ->where('id', $request->article_id)
            ->first();

        if ($request->ip()) {
            ++$article->click;
            $article->save();
        }

        return view('home.article', ['article' => $article]);
    }
}
